import { getGameObjectById } from "../engine";
import { Audio } from "../engine/Audio";
import { Behaviour } from "../engine/Behaviour";
import { BitmapWithClipRender } from "../engine/BitmapWithClipRender";
import { Transform } from "../engine/Transform";
import { number } from "../engine/validators/number";
import { ChangeScene } from "./ChangeScene";
import { Display } from "./Display";
import { Drag } from "./Drag";
import { LeftMouseClick } from "./LeftMouseClick";

export class Test extends Behaviour {

   one:boolean=true
    onStart() {
        
        this.gameObject.onClick = () => {
            //this.engine.scenenumber=3;
            getGameObjectById('sound1').getBehaviour(Audio).Play();
            if(this.one==false){
                getGameObjectById('sound1').getBehaviour(Audio).ChangeVolume(1);//Volume音量的大小只能为0——1，所以ChangeVolume()中传入的数据为0-1
                this.one=true;
            }else{
                getGameObjectById('sound1').getBehaviour(Audio).ChangeVolume(0.5);
                this.one=false
            }
            //console.log("test",this.engine.scenenumber)
            //getGameObjectById("eggSpread").getBehaviour(BitmapWithClipRender).clip.IsClear=true;
            //getGameObjectById("sauceSpread").getBehaviour(BitmapWithClipRender).clip.IsClear=true;
            //getGameObjectById('changeScene').getBehaviour(ChangeScene).LoadScene("scene2");

        };
    }

    onTick(duringTime: number) {
        // if(getGameObjectById("shovelPut").getBehaviour(Drag).IsTouch){
        //     console.log("涂鸡蛋")
        //     //getGameObjectById("eggSpread").getBehaviour(BitmapWithClipRender).clip.IsClear=false;
        //     const clip = {x:getGameObjectById("shovelPut").getBehaviour(Drag).mousemove.x-getGameObjectById("skinPut").getBehaviour(Transform).x,
        //                   y:getGameObjectById("shovelPut").getBehaviour(Drag).mousemove.y-getGameObjectById("skinPut").getBehaviour(Transform).y,
        //                   width:100,
        //                   height:100  }
        //     getGameObjectById("eggSpread").getBehaviour(BitmapWithClipRender).clips.push(clip)

        // }
        // if(getGameObjectById("shuaziPut").getBehaviour(Drag).IsTouch){
        //     console.log("涂酱")
        //     const clip = {x:getGameObjectById("shuaziPut").getBehaviour(Drag).mousemove.x-getGameObjectById("skinPut").getBehaviour(Transform).x,
        //                   y:getGameObjectById("shuaziPut").getBehaviour(Drag).mousemove.y-getGameObjectById("skinPut").getBehaviour(Transform).y,
        //                   width:100,
        //                   height:100  }
        //     getGameObjectById("sauceSpread").getBehaviour(BitmapWithClipRender).clips.push(clip)
            
        // }
       
        
    }
}